/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.base.entity;

import com.chlitina.store.common.persistence.BaseEntity;

/**
 * 客户组与客户复合id
 * @author lvbo
 * @version 2013-07-23
 */
public class CustomerGroupDetailPK extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private CustomerGroup customerGroup;
	private Customer customer;
	
	public CustomerGroupDetailPK() {
	}
	
	public CustomerGroup getCustomerGroup() {
		return customerGroup;
	}
	public void setCustomerGroup(CustomerGroup customerGroup) {
		this.customerGroup = customerGroup;
	}
	
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	@Override
	public int hashCode() {
		return this.customer.hashCode() + this.customerGroup.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final CustomerGroupDetailPK other = (CustomerGroupDetailPK) obj;
		if (customer.getId() == other.getCustomer().getId() &&
				customerGroup.getId() == other.getCustomerGroup().getId()) {
			return true;
		} 
		return false;
	}
}


